//
//  LMStatusCell.m
//  李明微博
//
//  Created by apple on 15/12/16.
//  Copyright (c) 2015年 李明. All rights reserved.
//

#import "LMStatusCell.h"
#import "LMOriginalView.h"
#import "LMRetweetView.h"
#import "LMToolView.h"
#import "LMStatusFrame.h"

@interface LMStatusCell()

@property(nonatomic,weak)LMOriginalView *orginalView;

@property(nonatomic,weak)LMRetweetView *retweetView;

@property(nonatomic,weak)LMToolView *toolView;

@end


@implementation LMStatusCell




- (instancetype)initWithStyle:(UITableViewCellStyle)style resuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setUpAllchildView];
    }
    
    return self;
}

- (void)setUpAllchildView
{
    //原创
    LMOriginalView  *orginalView = [[LMOriginalView alloc] init];
    
    [self addSubview:orginalView];
    
    _orginalView = orginalView;
    
    //转发
    
    LMRetweetView *retweetView = [[LMRetweetView alloc] init];
    
    [self addSubview:retweetView];
    
    _retweetView = retweetView;
    
    
    //工具
    
    LMToolView * toolView = [[LMToolView alloc] init];
    
    [self addSubview:toolView];
    
    _toolView = toolView;
}

-(void)setStatusFrame:(LMStatusFrame *)statusFrame
{
    _statusFrame = statusFrame;
    _orginalView.frame = statusFrame.originalViewFrame;
    _orginalView.statusFrame = statusFrame;
    
    _retweetView.frame = statusFrame.retweetViewFrame;
    _retweetView.statusFrame = statusFrame;
    
    _toolView.frame = statusFrame.toolFrame;
    _toolView.statusFrame = statusFrame;
}

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *ID =@"cell";
    
    id cell = [tableView dequeueReusableCellWithIdentifier:ID];
    
    if (cell ==nil) {
        cell = [[self alloc] initWithStyle:UITableViewCellStyleSubtitle resuseIdentifier:ID];
    }
    return  cell;

}

@end
